package com.happy.cat.project.system.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.happy.cat.project.system.mapper.UserOfficialAccountMapper;
import com.happy.cat.project.system.domain.UserOfficialAccount;
import com.happy.cat.project.system.service.IUserOfficialAccountService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户粉丝、关注Service业务层处理
 *
 * @author verne
 * @date 2020-09-03
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserOfficialAccountServiceImpl extends ServiceImpl<UserOfficialAccountMapper, UserOfficialAccount> implements IUserOfficialAccountService {

    @Override
    public Integer countsToAccountId(Long id, int type) {
        return this.lambdaQuery().eq(UserOfficialAccount::getFocusId,id)
                .eq(UserOfficialAccount::getFocusType, type)
                .count();
    }

    @Override
    public Integer countsToFansId(Long id, int type) {
        return this.lambdaQuery().eq(UserOfficialAccount::getAccountId,id)
                .eq(UserOfficialAccount::getFocusType, type)
                .count();
    }
}
